#ifndef __BSP_SYSTEM_H
#define __BSP_SYSTEM_H
// 文件系统配置参数结构体
typedef struct {
    float ratio;
    float limit;
} Config_t;
//FLASH写入扇区
#define CONFIG_ADDR_1    0x0000     // 第1个配置
#define CONFIG_ADDR_2    0x01000     // 第2个配置
#define CONFIG_ADDR_3    0x02000     // 第3个配置
#define CONFIG_ADDR_4    0x03000     // 第4个配置 
//ADC采样周期枚举
typedef enum{
	SAMPLE_TIME_5s = 5,
	SAMPLE_TIME_10s = 10,
	SAMPLE_TIME_15s = 15
}SAMPLE_TIME;
/*系统头文件放置区域*/
#include "main.h"
#include "usart.h"
#include "adc.h"
#include "dac.h"
#include "tim.h"
#include "fatfs.h"
#include "sdio.h"
#include "stdio.h"
#include "string.h"
#include "stdarg.h"
#include "stdint.h"
#include "stdbool.h"
//日志结构体
typedef struct {
    char operation[256];     // 操作名称（如"RTC_CONFIG", "RATIO_SET"等）
    char result[256];       // 操作结果描述
    uint32_t timestamp;     // 操作时间戳
} LogEntry_t;
/*组件头文件*/
#include "ebtn.h"
#include "ringbuffer.h"
#include "gd25qxx.h"
#include "oled.h"
/*用户编写模块驱动头文件区域*/
#include "scheduler.h"
#include "user_led.h"
#include "user_key.h"
#include "user_btn.h"
#include "user_uart.h"
#include "user_adc.h"
#include "user_flash.h"
#include "user_oled.h"
#include "user_rtc.h"
/*系统功能业务逻辑头文件区域*/
#include "system_manager.h"
#include "command_handler.h"
#include "config_manager.h"
#include "data_acquisition.h"
#include "data_storage.h"
/*用户外部引用变量声明*/
extern uint8_t ucled[6];//led状态存储数组
extern uint8_t uart_rx_buffer[BUFFER_SIZE];//超时解析方案数据缓存区
extern uint8_t uart_rx_index;//超时解析方案缓存区索引值
extern uint8_t uart_dma_buffer[BUFFER_SIZE];//串口dma数据缓存区
extern DMA_HandleTypeDef hdma_usart1_rx;//串口dma句柄
extern DMA_HandleTypeDef hdma_usart3_rx;
extern UART_HandleTypeDef huart1;
extern DMA_HandleTypeDef hdma_adc1;
extern DAC_HandleTypeDef hdac;
extern DMA_HandleTypeDef hdma_dac1;
extern RTC_HandleTypeDef hrtc;
extern struct rt_ringbuffer uart_ringbuffer_t;//ringbuffer结构体
extern uint8_t uart_ringbuffer_pool[BUFFER_SIZE];//ringbuffer数据池
extern uint8_t adc_run_state;
extern SAMPLE_TIME adc_sample_time;
extern uint32_t adc_out_time;
extern float volatage;//存储转换后的电压值
extern Config_t user_ctr;
extern uint8_t output_time_type;
extern int tf_test_flag;
extern uint8_t data_stored_flag;  // 数据存储标志位
extern float v_get;
#endif

